home *** CD-ROM | disk | FTP | other *** search
- /*
- 261.63Hzのサイン波(80dB:3秒)
- */
-
- #include <stdio.h>
- #include <math.h>
-
- #define GAIN (10000) //80dB
-
- #define TAR_FREQ (261.63) //出力
- #define WAV_FREQ (44100) //出力ファイルの周波数
- #define TIME (3) //出力秒数
-
- #define PHY1 (2.1358) //1/44100あたりの進行角度*10000
- //261.63*360/44100*10000
-
- #define RAD (3.14159265/180)
- #define PHY1RAD (0.037257061) //PHY1*RAD
-
- short Buf[WAV_FREQ*TIME];
-
-
- int main(void)
- {
- FILE *fp;
- int cnt,fcnt;
-
- for( cnt=0;cnt<WAV_FREQ*TIME;cnt++ ){
- Buf[cnt]=(short)(sin(cnt*PHY1RAD)*GAIN);
- }
-
-
- fp=fopen("W000.m44","wb");
- fwrite(Buf,sizeof(short),WAV_FREQ*TIME,fp);
- fclose(fp);
-
- return(0);
- }
-
-
-